package com.ruima.study.arithmetic.linkednode;

/**
 * <p>
 * <p></p>
 * <p>
 * <p>Copyright (c) 2024-10-13 10:11 , 马锐个人 All Rights Reserve</p>
 *
 * @author marui
 * @version [V1.0]
 */
public class CycleNode {
    public int[] joseph(int n, int m) {


        return null;
    }

    private Node buildCycleNode(int n) {
        Node tail = new Node(n);
        Node head = new Node(1);
        tail.next = head;

        Node curNode = head;
        Node next = null;
        for (int i = 2; i < n; i++) {
            if (i == 2) {
                head.next = curNode;
                continue;
            }
            if (i == n - 1) {
                curNode.next = tail;
                continue;
            }
            curNode = new Node(i);
        }

        return head;
    }


    class Node {
        public int value;
        public Node next;

        public Node() {
        }

        public Node(int value) {
            this.value = value;
        }
    }
}


